<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="ss" uri="/WEB-INF/stripes-security.tld" %>
<s:layout-render name="/layout.jsp" title="Creature types">
    <s:layout-component name="menu"></s:layout-component>
    <s:layout-component name="main_content">
        <s:useActionBean var="ab" beanclass="cz.muni.fi.pa165.creatures.web.CreatureTypeActionBean"/>    
        <div class="main-content">
            <div class="content">
                 <ss:secure roles="admin">
                <img src="${pageContext.request.contextPath}/images/banner-admin.png" alt="Banner" id="banner"/>                
                </ss:secure>
                <ss:secure roles="user">
                <img src="${pageContext.request.contextPath}/images/banner-scout.png" alt="Banner" id="banner"/>                
                </ss:secure>
                <s:form beanclass="cz.muni.fi.pa165.creatures.web.CreatureTypeActionBean">
                    <h1><f:message key="detail"/></h1>
                    <table>
                        <tr>
                            <th><f:message key="creatureTypeDTO.name"/></th>
                            <td><s:text readonly="true" name="creatureTypeDTO.name"/></td>
                            <th><s:label name="creatureTypeDTO.maxHitPoints"/></th>
                            <td><s:text readonly="true" name="creatureTypeDTO.maxHitPoints"/></td>
                        </tr>
                        <tr>        
                            <th><s:label name="creatureTypeDTO.creaturesInGroup"/></th>
                            <td><s:text readonly="true" name="creatureTypeDTO.creaturesInGroup"/></td>
                            <th><s:label name="creatureTypeDTO.defenseStrategy"/></th>
                            <td>
                                <c:set var="strategy" value="DefenseStrategy.${ab.creatureTypeDTO.defenseStrategy}"/>
                                <f:message key="${strategy}"/>
                            </td>
                        </tr>
                        <tr>
                            <th><s:label name="creatureTypeDTO.description"/></th>
                        </tr>
                    </table> 
                        
                    <s:textarea name="creatureTypeDTO.description" readonly="true"></s:textarea>
                    <table>
                        <thead>
                            <tr>
                                <th><s:label name="creatureTypeWeaponDTO.weaponName"/></th>
                                <th><s:label name="creatureTypeWeaponDTO.efficiency"/></th>
                            </tr>
                        </thead>
                         <c:forEach items="${ab.effectivity}" var="creatureTypeWeaponDTO">
                                        <tr>
                                            <td><c:out value="${creatureTypeWeaponDTO.weaponName}"/></td>
                                            <td><c:out value="${creatureTypeWeaponDTO.efficiency}"/></td>
                                        </tr>
                         </c:forEach>
                    </table>
                    
                    <s:submit name="back"><f:message key="back"/></s:submit>
                </s:form>
            </div>
        </div>
    </s:layout-component>
</s:layout-render>
